package router

import (
	"context"
	"github.com/gogf/gf/v2/net/ghttp"
	"server_go/addons/hgexample/controller/admin/sys"
	"server_go/addons/hgexample/global"
	"server_go/addons/hgexample/router/genrouter"
	"server_go/internal/consts"
	"server_go/internal/library/addons"
	"server_go/internal/service"
)

func Admin(ctx context.Context, group *ghttp.RouterGroup) {
	prefix := addons.RouterPrefix(ctx, consts.AppAdmin, global.GetSkeleton().Name)
	group.Group(prefix, func(group *ghttp.RouterGroup) {
		group.Bind(
			sys.Index,
		)
		group.Middleware(service.Middleware().AdminAuth)
		group.Bind(
			sys.Comp,
			sys.Config,
			sys.Table,
			sys.TreeTable,
		)
	})

	// 注册生成路由
	genrouter.Register(ctx, group)
}
